// 字符串
let str = 'coderzrf';  // let str: string
str = 'onlyString';

// 数值
let num = 123; // let num: number
num = 999.0

// 布尔值
let bool = true; // let bool: boolean
bool = false;

// 数组
let arr = ['coderzrf', 24]; // let arr: (string | number)[]
arr.push('string', 0);

// 对象
let obj = { name: 'coderzrf', age: 24 }; // let obj: {name: string; age: number; }
obj.name = 'onlyBeReplacedNameAndAge';
// obj.asc = 'error'; //只能修改已有的属性和方法
// 嵌套对象
let comObj = {
  name: 'coderzrf',
  age: 24,
  asc: {
    gender: 'man',
    hobby: ['coding', true]
  }
}
/* let comObj: {
  name: string;
  age: number;
  asc: {
    gender: string;
    hobby: (string | boolean)[];
  };
} */

// 函数
let func = () => "isFunction" //let func: () => string

